var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var utils = require('./utils');
var devLoaders = require('./loaders.dev');
var env ='DEV';

module.exports = function(options) {
    return {
        cache: true,

        resolve: {
            extensions: ['.js', '.json', '.ts']
        },

        module: {
            rules: devLoaders
        },

        entry: entries(utils.root('src') + '/*'),

        plugins: [

            new ExtractTextPlugin("assets/[name].css"),
            new CopyWebpackPlugin([
                {
                    from: './src/config',
                    to: 'config',
                    force: true
                },
                {
                    from: './src/assets/',
                    to: 'assets',
                    force: true,
                    ignore: ['*.scss', ]
                }
            ])
        ]
    };
};

function entries(globPath) {
    var entries = {
        'app': './src/bootstrap/main.ts',
        'style': './src/assets/lib.scss',
        'appStyles': './src/assets/app.scss'
    };
    return entries;
}